home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Double Buffering
- ;----------------
- ;This just shows how to double buffer the screen. You can also try out
- ;triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
- ;GameScreen.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "DoubleBuffer",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- lea ScreenTags(pc),a0 ;Add screen for use.
- CALL AddScreen
- tst.l d0
- beq.s .Error_Screen
-
- move.l Screen(pc),a0
- lea PictureTags(pc),a1 ;Load background picture.
- move.l GS_MemPtr1(a0),PicData
- CALL LoadPic
- tst.l d0
- beq.s .Error_Picture
-
- move.l Picture(pc),a1
- move.l PIC_Palette(a1),GS_Palette(a0)
- CALL UpdatePalette
-
- CALL ShowScreen
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Picture(pc),a1
- CALL FreePic
- .Error_Picture
- move.l Screen(pc),a0
- CALL DeleteScreen ;Give back screen memory etc.
- .Error_Screen
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: CALL WaitVBL ;Nice VBL wait for multi-tasking.
- CALL SwapBuffers
- moveq #JPORT1,d0
- moveq #JT_ZBXY,d1
- CALL ReadJoyPort
- btst #MB_LMB,d0
- beq.s Main
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- ScreenTags:
- dc.l TAGS_GAMESCREEN
- Screen: dc.l 0
- dc.l GSA_ScrWidth,320
- dc.l GSA_ScrHeight,256
- dc.l GSA_Attrib,DBLBUFFER
- dc.l GSA_AmtColours,32
- dc.l TAGEND
-
- PictureTags:
- dc.l TAGS_PICTURE
- Picture dc.l 0
- dc.l PCA_Data
- PicData dc.l 0
- dc.l PCA_Width,320
- dc.l PCA_Height,256
- dc.l PCA_AmtColours,32
- dc.l PCA_Options,GETPALETTE
- dc.l PCA_File,.file
- dc.l TAGEND
-
- .file dc.b "GMS:demos/data/PIC.Green",0
- even
-